package te2;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class datediff {

public static void main(String[] args) {
	System.out.println(System.currentTimeMillis());
	
	SimpleDateFormat st=new SimpleDateFormat("yyyy-MM-dd");	
	try {
		Date curr = st.parse(st.format(new Date()));
		String date="2017-03-02";
		Date dates = st.parse(date);
	long days = daysBetweenTwoDate(dates, curr);
			System.out.println(days);
		
	} catch (ParseException e) {
		e.printStackTrace();
	}
	
	
	
}

public static long daysBetweenTwoDate(java.util.Date date1,
		java.util.Date date2) {
	long nDay = (date1.getTime() - date2.getTime()) / 86400000L > 0L ? (date1
			.getTime() - date2.getTime()) / 86400000L
			: (date2.getTime() - date1.getTime()) / 86400000L;

	return nDay;
}
}
